//this GObserverTester
//andycai.sc@gmail.com 2012-04-19

#ifndef GOBSERVERTESTER_H_INCLUDED
#define GOBSERVERTESTER_H_INCLUDED

#include "GModelObserver.h"
#include "GParallel/GTimer.h"
#include "GFrameTester.h"

class TimerDomain : public GDomainObject, public GTimer
{
public:
    TimerDomain(GDataReceiver* dataReceiver = 0);
    ~TimerDomain();

    enum Event
    {
        TIME_CHANGED = 1
    };

protected:
    void schedule();
};

class TimerWatcher1 : public GDataReceiver
{
public:
    TimerWatcher1();
    ~TimerWatcher1();

    void update(GDomainObject* domainObj);

    void process(GDomainEvent* dEvent, GDomainObject* dObject);

private:
    TimerDomain* m_timerDomain;
};

class TimerWatcher2 : public GDataReceiver
{
public:
    TimerWatcher2();
    ~TimerWatcher2();

    void update(GDomainObject* domainObj);

    void process(GDomainEvent* dEvent, GDomainObject* dObject);

private:
    TimerDomain* m_timerDomain;
};

class GObserverTester : public GFrameTester
{
public:
    GObserverTester(const string& testName = "GObserver");
    ~GObserverTester();

    void run();
};


#endif // GOBSERVERTESTER_H_INCLUDED
